package com.ruibang.glass.purchase.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruibang.glass.purchase.entity.PurchaseApprovalSupplier;
import com.ruibang.glass.purchase.mapper.PurchaseApprovalSupplierMapper;
import com.ruibang.glass.purchase.service.PurchaseApprovalSupplierService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 采购审批物品列表 服务实现类
 * </p>
 *
 * @author mameng
 * @since 2024-04-17
 */
@Service
public class PurchaseApprovalSupplierServiceImpl extends ServiceImpl<PurchaseApprovalSupplierMapper, PurchaseApprovalSupplier> implements PurchaseApprovalSupplierService {

    @Override
    public void updateIsUsedById(String approvalId,String supplierId, String isUsed) {
        if (StringUtils.isNotBlank(supplierId)&&StringUtils.isNotBlank(isUsed)){
            this.lambdaUpdate().set(PurchaseApprovalSupplier::getIsUsed,isUsed).eq(PurchaseApprovalSupplier::getPurchaseApprovalId,approvalId).eq(PurchaseApprovalSupplier::getSupplierId,supplierId).update();
        }
    }
}
